import  cv2
import numpy as np
if __name__ == '__main__':
    image_np = cv2.imread('work1.jpg')

    image_gray = cv2.cvtColor(image_np, cv2.COLOR_BGR2GRAY)
    _, image_thresh = cv2.threshold(image_gray, 127, 255, cv2.THRESH_OTSU + cv2.THRESH_BINARY)
    countours, hierarchy = cv2.findContours(image_thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
    for cnt in countours:
        print(cnt.shape)
        if cnt.shape[0] > 60:
            (x, y), radius = cv2.minEnclosingCircle(cnt)
            x, y, radius = int(x), int(y), int(radius)
            cv2.circle(image_np, (x, y), radius, (0, 0, 255), 2, cv2.LINE_AA)

    cv2.imshow('', image_np)
    cv2.imwrite('zuoye1.jpg', image_np)
    cv2.waitKey(0)